#include <errno.h>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <strings.h>
#include <fcntl.h>

#include <sys/stat.h>
#include <sys/types.h>



int main( int argc, char** argv)
{
	char buf[1024];
	////////////////////////
	mkfifo( "FIFO",0644);
	int fd_main_fifo = open( "MAIN_FIFO", O_RDWR | O_NDELAY);
	fd_main_fifo = open( "MAIN_FIFO", O_RDWR | O_NDELAY);
	
	int pipe_size = 0;
	
	int tmp = 1;
	while ( tmp != -1  )
	{
		tmp = write( fd_main_fifo, buf, 8);
		if ( tmp > 0 )
		{
			pipe_size += tmp;
		}
	}
	
	if ( tmp == -1)
		perror("adsasd");
	printf( "pipe_size  = %d\n",pipe_size);
	
	unlink("FIFO");
}
